<?php

/**
 * planning_phase form base class.
 *
 * @method planning_phase getObject() Returns the current form's model object
 *
 * @package    gesp
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class Baseplanning_phaseForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'plnphs_id'               => new sfWidgetFormInputHidden(),
      'plnphs_prj_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => false)),
      'plnphs_libelle'          => new sfWidgetFormInputText(),
      'plnphs_ordre'            => new sfWidgetFormInputText(),
      'plnphs_date_debut'       => new sfWidgetFormDate(),
      'plnphs_date_echeance'    => new sfWidgetFormDate(),
      'plnphs_date_fin'         => new sfWidgetFormDate(),
      'plnphs_charge_estimee'   => new sfWidgetFormInputText(),
      'plnphs_charge_consommee' => new sfWidgetFormInputText(),
      'plnphs_charge_restante'  => new sfWidgetFormInputText(),
      'plnphs_termine'          => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'plnphs_id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('plnphs_id')), 'empty_value' => $this->getObject()->get('plnphs_id'), 'required' => false)),
      'plnphs_prj_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('projet'))),
      'plnphs_libelle'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'plnphs_ordre'            => new sfValidatorInteger(array('required' => false)),
      'plnphs_date_debut'       => new sfValidatorDate(array('required' => false)),
      'plnphs_date_echeance'    => new sfValidatorDate(array('required' => false)),
      'plnphs_date_fin'         => new sfValidatorDate(array('required' => false)),
      'plnphs_charge_estimee'   => new sfValidatorNumber(array('required' => false)),
      'plnphs_charge_consommee' => new sfValidatorNumber(array('required' => false)),
      'plnphs_charge_restante'  => new sfValidatorNumber(array('required' => false)),
      'plnphs_termine'          => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('planning_phase[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'planning_phase';
  }

}
